using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using WebOS.Core.Security.Models;
using WebOS.Core.Security.Models.Mapping;

namespace LAMSDK.Security
{
	public class WEBOSContext : DbContext
	{
        static WEBOSContext()
		{

		}

		public DbSet<Department> Departments { get; set; }
		public DbSet<Function> Functions { get; set; }
		public DbSet<Organization> Organizations { get; set; }
		public DbSet<Permission> Permissions { get; set; }
		public DbSet<Person> Persons { get; set; }
		public DbSet<Post> Posts { get; set; }
		public DbSet<Role> Roles { get; set; }
		public DbSet<User> Users { get; set; }
		public DbSet<UserInDept> UserInDepts { get; set; }
		public DbSet<UserInRole> UserInRoles { get; set; }
		public DbSet<UserSetting> UserSettings { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			modelBuilder.Configurations.Add(new DepartmentMap());
			modelBuilder.Configurations.Add(new FunctionMap());
			modelBuilder.Configurations.Add(new OrganizationMap());
			modelBuilder.Configurations.Add(new PermissionMap());
			modelBuilder.Configurations.Add(new PersonMap());
			modelBuilder.Configurations.Add(new PostMap());
			modelBuilder.Configurations.Add(new RoleMap());
			modelBuilder.Configurations.Add(new UserMap());
			modelBuilder.Configurations.Add(new UserInDeptMap());
			modelBuilder.Configurations.Add(new UserInRoleMap());
			modelBuilder.Configurations.Add(new UserSettingMap());
		}
	}
}

